package cn.com.nes.mybatis.agent.system.mapper;

import cn.com.nes.mybatis.agent.system.entity.RepairUser;
import cn.com.nes.mybatis.agent.system.entity.TUser;
import cn.com.nes.site.entity.UserInfo;
import cn.com.nes.site.service.project.dto.MyTeamInfoDTO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 * @author nes
 * @since 2022-08-19
 */
public interface TUserMapper extends BaseMapper<TUser> {

    /**
     * 根据用户Id查询用户信息
     * @param userId 用户唯一ID
     * @return
     */
    TUser getUserInfoByUserId(String userId);

    /**
     * 根据用户Id查询用户信息
     * @param userId t_user表的id
     * @return
     */
    TUser getUserDetailByUserId(@Param("userId") String userId);

    List<Map<String, Object>> selectNearCSSInfo(TUser tUser);


    Map adminAuth(String roleId);


    String selectSjlyName(String sjly);


    List<TUser> getUserByDepartment(String departmentId);


    void removeUserDepartment(@Param("departmentId") String departmentId, @Param("operateUserId") Long operateUserId,
            @Param("operateDate") Date operateDate);


    List<TUser> getUserByCompany(String companyId);

    List<TUser> getUsers(@Param("companyIdOrDepartmentId") String companyIdOrDepartmentId);
    List<RepairUser> getRepairUser(@Param("companyIdOrDepartmentId") String companyIdOrDepartmentId);

    List<TUser> getAllUnDeletedUsers();

    Integer checkPhoneNumberDuplicated(@Param("phone") String phone, @Param("stationId") String stationId);

    void updateByUuid(TUser userInfo);

    void delUserByUuid(@Param("stationId") String stationId);

    String getUserTypeByUserId(@Param("userId") String userId);

    String getUserAreaCode(@Param("userId") String userId);

    String getCompanyType(@Param("userId") String userId);

    /**
     * 使用userId查询坐标
     * @param userId
     * @return
     */
    Map<String, String> getCoordinateByUserId(@Param("userId") String userId);

    Map<String, String> getCoordinateByLocationId(@Param("locationId") String locationId);

    List<String> getUserIdList(@Param("companyId") String companyId);

    String getPasswordByUuid(@Param("uuid") String uuid);


    TUser getUser(@Param("userId") Long userId, @Param("companyId") String companyId);

    Integer getEasyRepairUserIdCount(@Param("uuid") String uuid, @Param("easyRepairUserId") Long easyRepairUserId);

    TUser getAllUserByUuId(@Param("uuid") String uuid);

    TUser getcallCenterUserId(@Param("uuid") String uuid);

    void bindEasyRepairAccount(TUser userInfo);

    void bindCallCenterAccount(TUser userInfo);

    Boolean checkHaveForeman(@Param("departmentId") String departmentId);

    List<MyTeamInfoDTO> getMyTeamInfoList(@Param("easyRepairUserId") Long easyRepairUserId);

    Boolean checkIsForeman(@Param("easyRepairUserId") String easyRepairUserId);

    List<String> getCallCenterUserIdListByEasyRepairUserId(@Param("easyRepairUserId") Long easyRepairUserId);

    TUser getServiceUserInfo(@Param("projectUuidId") String projectUuidId, @Param("easyRepairUserId") Long easyRepairUserId);

    TUser getUserInfoByCallCenterUserId(@Param("callCenterUserId")String callCenterUserId);

    UserInfo selectUserByCompanyId(@Param("companyId") String companyId);

    void insert(@Param("uinfo") UserInfo uinfo);
}
